package com.dictionary.hi;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;

public class FullPageImageActivity extends Activity {
	private LinearLayout ll;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);        
        requestWindowFeature(Window.FEATURE_NO_TITLE);
    	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        super.onCreate(savedInstanceState);
		setContentView(R.layout.image_dialog);
	
		WebView webView = (WebView) findViewById(R.id.webView1);
		ll = (LinearLayout)findViewById(R.id.linearLayoutLoading);
		webView.getSettings().setBuiltInZoomControls(true);
		webView.getSettings().setLoadWithOverviewMode(true);
	    webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
	    webView.setScrollbarFadingEnabled(true);		
	    webView.setWebViewClient(new DemoWebViewClient());	    
	    webView.loadUrl(getIntent().getStringExtra("url"));
	}
	
	private class DemoWebViewClient extends WebViewClient{
	    
    	@Override
    	public boolean shouldOverrideUrlLoading(WebView view, String url) {
    			view.loadUrl(url);    		
    			return super.shouldOverrideUrlLoading(view, url);
    		} 	
    	@Override
    	public void onPageFinished(WebView view, String url) {
    		super.onPageFinished(view, url);
    		if(ll!=null)
    			ll.setVisibility(View.GONE);	    				    		
    	}
    }
}
